package com.yangxd.hospital.controller;


import com.yangxd.hospital.entity.RoleUser;
import com.yangxd.hospital.service.RoleUserService;
import com.yangxd.response.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yangxd
 * @since 2021-04-24
 */
@RestController
@RequestMapping("/hospital/role-user")
public class RoleUserController {

    @Autowired
    private RoleUserService roleUserService;

    @PostMapping("/saveRoleUser")
    @ApiOperation(value = "新增用户角色关系")
    public Result saveRoleUser(@RequestBody RoleUser roleUser) {
        try{

            roleUserService.saveRoleUser(roleUser);
            return Result.ok();

        }catch (Exception e) {
            e.printStackTrace();
            return Result.error();
        }

    }

}

